
package org.apache.solr.core;

import org.apache.solr.search.SolrIndexSearcher;
import org.apache.solr.util.plugin.NamedListInitializedPlugin;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public interface SolrEventListener extends NamedListInitializedPlugin {

    static final Logger log = LoggerFactory.getLogger(SolrCore.class);

    public void postCommit();

    public void postSoftCommit();

    /**
     * The searchers passed here are only guaranteed to be valid for the
     * duration of this method call, so care should be taken not to spawn
     * threads or asynchronous tasks with references to these searchers.
     * <p/>
     * Implementations should add the
     * {@link org.apache.solr.common.params.EventParams#EVENT} parameter and set
     * it to a value of either: <ul>
     * <li>{@link org.apache.solr.common.params.EventParams#FIRST_SEARCHER} -
     * First Searcher event</li>
     * <li>{@link org.apache.solr.common.params.EventParams#NEW_SEARCHER} - New
     * Searcher event</li> </ul>
     *
     * Sample:
     * <pre>
     * if (currentSearcher != null) {
     * nlst.add(CommonParams.EVENT, CommonParams.NEW_SEARCHER);
     * } else {
     * nlst.add(CommonParams.EVENT, CommonParams.FIRST_SEARCHER);
     * }
     *
     * </pre>
     *
     * @see
     * org.apache.solr.core.AbstractSolrEventListener#addEventParms(org.apache.solr.search.SolrIndexSearcher,
     * org.apache.solr.common.util.NamedList)
     *
     * @param newSearcher The new
     * {@link org.apache.solr.search.SolrIndexSearcher} to use
     * @param currentSearcher The existing
     * {@link org.apache.solr.search.SolrIndexSearcher}. null if this is a
     * firstSearcher event.
     *
     */
    public void newSearcher(SolrIndexSearcher newSearcher, SolrIndexSearcher currentSearcher);
}
